/**
* @file lcd_if_spi4.h
* @brief  lcd interface for spi4w
* @details 
* @author huangbin
* @version V1.0.0
* @date 2025-04-30
* @copyright All documents are copyrighted by Shenzhen Xinlongwei Technology Co., LTD.
*            They may not be used for commercial purposes without permission
*/
#ifndef __LCD_IF_SPI4_H__
#define __LCD_IF_SPI4_H__
#include "stdint.h"
#include "config.h"

#ifdef __cplusplus
 extern "C" {
#endif /* __cplusplus */
////////////////////////////define//////////////////////////////////////
#define LCD_SPI4_ALL_CLK                 RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB  	//clock
#define LCD_SPI4_CS_PORT				GPIOA				//lcd cs port
#define LCD_SPI4_CS_PIN				    GPIO_Pin_4				//lcd cs pin

#define LCD_SPI4_DC_PORT				GPIOB				//lcd RS port
#define LCD_SPI4_DC_PIN				    GPIO_Pin_13			//lcd RS pin

#define LCD_SPI4_RESET_PORT			    GPIOB				//lcd reset port
#define LCD_SPI4_RESET_PIN				GPIO_Pin_12				//lcd reset pin

#define LCD_SPI4_CLK_PORT				GPIOA				//lcd spi clock port
#define LCD_SPI4_CLK_PIN				GPIO_Pin_5			//lcd spi clock pin

#define LCD_SPI4_MOSI_PORT				GPIOA				//lcd mosi port
#define LCD_SPI4_MOSI_PIN				GPIO_Pin_7				//lcd mosi pin

//背光引脚
#define LCD_SPI4_BK_PORT               GPIOB
#define LCD_SPI4_BK_PIN                GPIO_Pin_1

#define LCD_SPI4_CS_HIGH()			GPIO_SetBits(LCD_SPI4_CS_PORT, LCD_SPI4_CS_PIN)
#define LCD_SPI4_CS_LOW()			GPIO_ResetBits(LCD_SPI4_CS_PORT, LCD_SPI4_CS_PIN)
             
#define LCD_SPI4_DC_HIGH()			GPIO_SetBits(LCD_SPI4_DC_PORT, LCD_SPI4_DC_PIN)
#define LCD_SPI4_DC_LOW()			GPIO_ResetBits(LCD_SPI4_DC_PORT, LCD_SPI4_DC_PIN)
            
#define LCD_SPI4_RESET_HIGH()		GPIO_SetBits(LCD_SPI4_RESET_PORT, LCD_SPI4_RESET_PIN)
#define LCD_SPI4_RESET_LOW()		GPIO_ResetBits(LCD_SPI4_RESET_PORT, LCD_SPI4_RESET_PIN)


#define LCD_SPI4_CLK_HIGH()		   GPIO_SetBits(LCD_SPI4_CLK_PORT, LCD_SPI4_CLK_PIN)
#define	LCD_SPI4_CLK_LOW()		   GPIO_ResetBits(LCD_SPI4_CLK_PORT, LCD_SPI4_CLK_PIN)

#define LCD_SPI4_MOSI_HIGH()	   GPIO_SetBits(LCD_SPI4_MOSI_PORT, LCD_SPI4_MOSI_PIN)
#define	LCD_SPI4_MOSI_LOW()		   GPIO_ResetBits(LCD_SPI4_MOSI_PORT, LCD_SPI4_MOSI_PIN)

#define LCD_SPI4_MISO_GET()			1

#define LCD_SPI4_BK_OFF()				GPIO_SetBits(LCD_SPI4_BK_PORT, LCD_SPI4_BK_PIN)
#define LCD_SPI4_BK_ON()				GPIO_ResetBits(LCD_SPI4_BK_PORT, LCD_SPI4_BK_PIN)


//复位
#define LCD_RESET_HIGH()		LCD_SPI4_RESET_HIGH()
#define LCD_RESET_LOW()		LCD_SPI4_RESET_LOW()
//片选
#define LCD_CS_HIGH()			LCD_SPI4_CS_HIGH()
#define LCD_CS_LOW()			LCD_SPI4_CS_LOW()
//寄存器和RAM选择切换
#define LCD_DC_HIGH()			LCD_SPI4_DC_HIGH()
#define LCD_DC_LOW()			LCD_SPI4_DC_LOW()

/////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif
/************************END OF FILE*************************************/

